package com.gator.desig_mode.responsibilitychain;



/**
 * @author 何章怀晓 hezhanghuaixiao
 * @version V1.0
 * @desc
 */
public class Client {

  public static void main(String[] args) {
    Request request = new Request(1, "曹操", 600);

    FirstHandler firstHandler = new FirstHandler("FirstHandler");
    SecondHandler secondHandler = new SecondHandler("SecondHandler");
    LastHandler lastHandler = new LastHandler("LastHandler");

    //设置执行顺序 注意：处理人构成环形 因为我们不确定第一个执行的Handler是哪一个
    //什么事情都是相对的，如果我们明确首个处理的handler是firstHandler，那么无需环形
    firstHandler.setNextHandler(secondHandler);
    secondHandler.setNextHandler(lastHandler);
    lastHandler.setNextHandler(firstHandler);

    //执行
    firstHandler.processorRequest(request);

  }

}
